package com.tree.common.util;

import org.springframework.core.NamedThreadLocal;

/**
 * @ClassName com.demo.common.util
 * Description: <类功能描述>. <br>
 * <p>
 * <使用说明>
 * </p>
 * @Author tree
 * @Date 2019-05-25 23:27
 * @Version 1.0
 */
public class TraceContextHolder {

    private static final ThreadLocal<String> traceHolder = new NamedThreadLocal<>("TraceContext");

    public static void remove(){
        traceHolder.remove();
    }

    public static String getCurrentTraceId(){
        return traceHolder.get();
    }

    public static void setCurrentTraceId(String traceId){
         traceHolder.set(traceId);
    }
}
